<html>
<head><meta charset="utf-8"><title>Cool bug (almost a feature) · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Cool.20bug.20(almost.20a.20feature).html">Cool bug (almost a feature)</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="202101280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Cool%20bug%20%28almost%20a%20feature%29/near/202101280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Cool.20bug.20(almost.20a.20feature).html#202101280">(Jun 26 2020 at 14:59)</a>:</h4>
<p>Inlay hint suggest the type of parameter for function:</p>
<p><a href="/user_uploads/4715/p5fW4IBHd1rYhuXaZkhKKvdz/image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/p5fW4IBHd1rYhuXaZkhKKvdz/image.png" title="image.png"><img src="/user_uploads/4715/p5fW4IBHd1rYhuXaZkhKKvdz/image.png"></a></div>



<a name="202101405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Cool%20bug%20%28almost%20a%20feature%29/near/202101405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Cool.20bug.20(almost.20a.20feature).html#202101405">(Jun 26 2020 at 15:00)</a>:</h4>
<p>To turn this into a proper feature, we should add completion which:</p>
<ul>
<li>looks at the unresolved locals in the function body</li>
<li>gets their types</li>
<li>suggest <code>local_name: LocalType</code>as completion for function parameter</li>
</ul>



<a name="202119533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Cool%20bug%20%28almost%20a%20feature%29/near/202119533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Paul Faria <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Cool.20bug.20(almost.20a.20feature).html#202119533">(Jun 26 2020 at 17:34)</a>:</h4>
<p>I've actually used this as if it was a feature before. But for local variables, not function parameters.</p>



<a name="202119646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Cool%20bug%20%28almost%20a%20feature%29/near/202119646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Cool.20bug.20(almost.20a.20feature).html#202119646">(Jun 26 2020 at 17:36)</a>:</h4>
<p>For local variables it is a feature, for function parameters it is not deliberate.</p>



<a name="202251072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Cool%20bug%20%28almost%20a%20feature%29/near/202251072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Cool.20bug.20(almost.20a.20feature).html#202251072">(Jun 28 2020 at 19:32)</a>:</h4>
<p>This sumtimes gives inappropriate beliefs that rustc type inference will do the work, e.g. it is common for rust-analyzer to show a type parameter hint for closure parameters, but flycheck still reports an error requiring me to specify the type explicitly...</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>